package practice1;

import java.util.Arrays;
import java.util.Scanner;

/**
 * dfs八皇后
 */
public class P1219 {

    private static int n;           //n个皇后
    private static int[] a;         //a[i]表示第i行的皇后落在第a[i]列
    private static boolean[] b = new boolean[100];     //b[i]表示第i列能否放
    private static boolean[] c = new boolean[100];     //c[i]与d[i]表示对角线能否放
    private static boolean[] d = new boolean[100];
    private static int count =0;
    private static void dfs(int i){
        for(int j=1;j<=n;j++){      //遍历第i行的每一列
            if(b[j] && c[i+j] && d[i-j+n]){
                a[i] = j;       //摆放皇后
                b[j] = false;           //设置剪枝
                c[i+j] = false;
                d[i-j+n] = false;
                if(i<n){
                    dfs(i+1);       //下一层
                }else {
                    print();            //到底了
                    System.out.println("————————————————————————————————————————————————————————————————————");
                    count++;
                }
                //回溯
                b[j] = true;
                c[i+j] =true;
                d[i-j+n] =true;
            }
        }
    }

    private static void print() {
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                if(a[i] == j){
                    System.out.print("*");
                }else {
                    System.out.print("+");
                }
            }
            System.out.println();
        }
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        a = new int[n+1];
        Arrays.fill(b,true);
        Arrays.fill(c,true);
        Arrays.fill(d,true);
        dfs(1);
        System.out.println(count);
    }
}
